package MaquinaVirtual;

import java.util.Vector;

public class Pila {

	private Vector<Dato> pila;
	private int cPila;
	
	public Pila(){
		cPila = -1;
		pila = new Vector<Dato>();
	}
	
	public boolean pilaVacia(){
		return cPila == -1;
	}
	
	public void apila(Dato d){
		cPila++;
		pila.add(d);
	}
	
	public Dato desapila(){
		Dato d;
		if(pilaVacia())
			return null;
		else{
			d = pila.get(cPila);
			pila.remove(cPila);
			cPila--;
		}
		return d;
	}
	
}
